<template>
   <div>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column fixed prop="film.name" label="片名" width="370">
      </el-table-column>
      <el-table-column prop="time" label="开场时间" width="320">
      </el-table-column>
      <el-table-column prop="cinema.name" label="影院" width="370">
      </el-table-column>
      <el-table-column prop="room.name" label="放映厅" width="220">
      </el-table-column>
      <el-table-column prop="price" label="售价" width="220">
      </el-table-column>
      <el-table-column fixed="right" label="选座购票" width="200">
        <template slot-scope="scope"> 
          <el-button @click="handleClick(scope.row.id)" type="text" size="small"
            >选座购票</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
  
</template>

<script>
import axios from 'axios';
export default {
  name: "Yc",
  data() {
    return{
      tableData:[]
    };
  },
  created() {
    this.getAllPlan();
  },
  methods:{
    getAllPlan(){
      axios.get("http://localhost:8888/plan").then(({data})=> {
        console.log(data)
        this.tableData = data;
    })
  },
   handleClick(id){
    console.log(id)
    sessionStorage.setItem("pid",id);
    this.$router.push("/index/buy");
  },
  }
};
</script>

<style scoped>

</style>